package com.hubujun.driverlicense;

import android.os.Environment;


import com.hubujun.driverlicense.util.Util;

import java.io.File;

public class DLExternalPath {

	public static final String CORE_PATH = ApplicationContext.getContext().getFilesDir().getAbsolutePath() + "/DriverLicense/";

	public static final String EXTERNAL_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath();

	public static final String DL_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hubujun/DriverLicense/";

	public static final String DL_CACHE = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hubujun/DriverLicense/Caches/";

	public static final String DL_FILE = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hubujun/DriverLicense/Files/";


	private DLExternalPath() {
	}

	/**
	 * 返回主数据库文件保存路径
	 * 
	 * @return
	 */
	public static String getMainDatabasePath() {
		return DLExternalPath.CORE_PATH + "DriverLicense.db";
	}

	public static String getCachePath() {
		if (Util.canWriteExternal()) {
			return DL_CACHE;
		} else {
			return ApplicationContext.getContext().getCacheDir().getAbsolutePath() + "/";
		}
	}

	public static String getNativeCachePath(String playerOrRecord) {
		File file = new File(getCachePath() + "native_crash/" + playerOrRecord);
		if (!file.exists())
			file.mkdirs();
		return getCachePath() + "native_crash/" + playerOrRecord;
	}
}
